home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(checked == "done")
- {
- time = getTimer();
- checked = "checking";
- }
- frame += 1;
- if(getTimer() - time > 1000)
- {
- FPS = frame;
- checked = "done";
- frame = 0;
- if(FPS < 20 and _quality == "HIGH")
- {
- _quality = "MEDIUM";
- }
- if(FPS > 25 and _quality == "MEDIUM")
- {
- _quality = "HIGH";
- }
- }
- if(collected == "red")
- {
- purplegems = 0;
- bluegems = 0;
- collected = "none";
- colourActive = "none";
- }
- if(collected == "purple")
- {
- redgems = 0;
- bluegems = 0;
- collected = "none";
- colourActive = "none";
- }
- if(collected == "blue")
- {
- purplegems = 0;
- redgems = 0;
- collected = "none";
- colourActive = "none";
- }
- if(redgems >= redNeeded and redneeded != "X")
- {
- colourActive = "red";
- }
- if(bluegems >= blueNeeded and blueneeded != "X")
- {
- colourActive = "blue";
- }
- if(purplegems >= purpleNeeded and purpleneeded != "X")
- {
- colourActive = "purple";
- }
- if(bonusScore > levelComplete and levelBoardDone == "TRUE")
- {
- bonusScore -= 10;
- }
- if(levelBoardDone == "TRUE")
- {
- Testscore += 10;
- }
- if(getProperty("_root.waterMC", _X) < -670)
- {
- setProperty("_root.waterMC", _X, 0);
- setProperty("_root.waterBackMC", _X, 0);
- }
- waterHeight -= waterSpeed;
- setProperty("_root.waterMC", _X, getProperty("_root.waterMC", _X) - 20);
- setProperty("_root.waterBackMC", _X, getProperty("_root.waterBackMC", _X) - 20);
- setProperty("_root.waterMC", _Y, getProperty("_root.BackgroundMC", _Y) + waterheight + 522);
- setProperty("_root.waterBackMC", _Y, getProperty("_root.BackgroundMC", _Y) + waterheight + 510);
- if(getProperty("_root.playerMC", _Y) - 20 > getProperty("_root.waterMC", _Y))
- {
- Air -= drownRate;
- if(Air < 0)
- {
- state = "dead";
- }
- }
- else
- {
- Air = 5;
- }
- if(enemyCol == "on" and invincibleTimer != "on")
- {
- enemyCol = "off";
- state = "dead";
- }
- if(invincibleTimer == "on" and nInvincible < 180)
- {
- nInvincible += 1;
- enemyCol = "off";
- setProperty("_root.counterMC.invincibleMC", _visible, true);
- }
- else
- {
- nInvincible = 0;
- invincibleTimer = "off";
- setProperty("_root.counterMC.invincibleMC", _visible, false);
- }
- if(state == "dead")
- {
- if(deadSound != "played")
- {
- _root.dead.start();
- deadSound = "played";
- }
- if(getProperty("_root.playerMC", _Y) < 750)
- {
- setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) - 16 + deathspeed);
- deathspeed += 3;
- }
- else
- {
- _root.score = score;
- lives -= 1;
- state = "Stopped";
- set("_root.codeMC:blueSwitch","off");
- set("_root.codeMC:redSwitch","off");
- set("_root.codeMC:purpleSwitch","off");
- air = 5;
- redgems = 0;
- bluegems = 0;
- purplegems = 0;
- colourActive = "none";
- currentGround = 500;
- setProperty("_root.backgroundMC", _X, 0);
- setProperty("_root.backgroundMC", _Y, 0);
- setProperty("_root.playerMC", _X, 197.2);
- setProperty("_root.playerMC", _Y, 97);
- _root.levelBoardMC.play();
- _root.backgroundMC.gotoAndPlay(currentlevel);
- deathspeed = 0;
- deadSound = "waiting";
- }
- }
- if(state == "Stopped")
- {
- if(left == "on")
- {
- direction = -1;
- speed = 1;
- currentJumpHeight = jumpHeight;
- state = "Accelerate";
- }
- if(right == "on")
- {
- direction = 1;
- speed = 1;
- currentJumpHeight = jumpHeight;
- state = "Accelerate";
- }
- }
- if(state == "Skid")
- {
- speed -= 2;
- if(speed <= 0)
- {
- state = "Stopped";
- }
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- }
- else
- {
- setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
- }
- }
- if(state == "Inertia")
- {
- speed -= 1;
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- }
- else
- {
- setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
- }
- if(direction == 1 and eval("_root.CodeMC:left") == "on")
- {
- state = "Stopped";
- }
- if(direction == -1 and eval("_root.CodeMC:right") == "on")
- {
- state = "Stopped";
- }
- if(speed == 0)
- {
- state = "Stopped";
- }
- }
- if(state == "Move")
- {
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- }
- else
- {
- setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
- }
- if(direction == -1 and left == "off")
- {
- state = "Inertia";
- }
- if(direction == 1 and right == "off")
- {
- state = "Inertia";
- }
- }
- if(state == "Accelerate")
- {
- speed += 1;
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
- {
- setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
- }
- }
- else
- {
- setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
- }
- if(direction == -1 and left == "off")
- {
- state = "Inertia";
- }
- if(direction == 1 and right == "off")
- {
- state = "Inertia";
- }
- if(speed == Move)
- {
- state = "Move";
- }
- }
- if(getProperty("_root.playerMC", _Y) < currentGround and jumping == "off" and state != "dead")
- {
- fallspeed += 2;
- falling = "on";
- if(fallspeed > gravity)
- {
- fallspeed = gravity;
- }
- if(getProperty("_root.playerMC", _Y) + fallspeed >= currentGround)
- {
- setProperty("_root.playerMC", _Y, currentGround - 1);
- fallspeed = 0;
- }
- if(getProperty("_root.playerMC", _Y) + fallspeed > scrollPointLower)
- {
- setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - fallspeed);
- }
- else
- {
- setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) + fallspeed);
- }
- }
- else
- {
- fallspeed = 0;
- falling = "off";
- }
- if(platformActive == 0)
- {
- currentGround = 400;
- }
- if(lastjump == "off" and state != "tutorial" and jump == "on" and fallspeed == 0 and jumping == "off")
- {
- jumping = "on";
- _root.jump.start();
- }
- if(jumping == "on" and jumpSpeed < currentJumpHeight)
- {
- jumpSpeed += 2;
- if(jump ne "on")
- {
- currentJumpHeight -= 2;
- }
- if(getProperty("_root.playerMC", _Y) < scrollPointUpper)
- {
- setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) + currentJumpHeight - jumpSpeed);
- }
- else
- {
- setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) - currentJumpHeight + jumpSpeed);
- }
- }
- else
- {
- jumping = "off";
- jumpSpeed = 0;
- currentJumpHeight = jumpHeight;
- }
- if(direction == 1)
- {
- if(state != "Stopped" and jumping == "off" and state != "dead")
- {
- _root.playerMC.gotoAndStop("right");
- }
- if(jumping == "on")
- {
- _root.playerMC.gotoAndStop("jump right");
- }
- if(state == "Stopped" and jumping == "off")
- {
- _root.playerMC.gotoAndStop("stopped right");
- }
- if(state == "tutorial")
- {
- _root.playerMC.gotoAndStop("stopped right");
- }
- }
- if(direction == -1)
- {
- if(state != "Stopped" and jumping == "off" and state != "dead")
- {
- _root.playerMC.gotoAndStop("left");
- }
- if(jumping == "on")
- {
- _root.playerMC.gotoAndStop("jump left");
- }
- if(state == "Stopped" and jumping == "off")
- {
- _root.playerMC.gotoAndStop("stopped left");
- }
- if(state == "tutorial")
- {
- _root.playerMC.gotoAndStop("stopped right");
- }
- }
- if(state == "dead")
- {
- _root.playerMC.gotoAndStop("death");
- }
- }
-